-
Notifications
You must be signed in to change notification settings - Fork 38
Add hover on i18n translations #640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add hover on i18n translations #640
Conversation
|
Whoa this is most wonderful! |
|
This is a fantastic addition to As of now, there's even a 3rd party addon built due to the lack of i18n support: https://github.com/bukhr/ruby-lsp-i18n |
|
Gave it a quick try with Zed and Cursor on app with a high number of translations. Seems to work nicely. |
|
It would also be nice if Go To Definition jumped to the entry in the locale file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small thinks
lib/ruby_lsp/ruby_lsp_rails/hover.rb
Outdated
| return unless receiver.name == :I18n | ||
|
|
||
| message = call_node.message | ||
| return unless message == "t" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also handle the translate method.
597cd33 to
228a9a1
Compare
First implementation for I18n support (#639)
How it works
I18n.t("hello")key string argument, request the server all the translations available and provide hover info for that.It address points 1 and 2 of the issue list:
And is usefull for updating and creating translations because it gives feedback that the used translations "is correct" because makes direct calls to the I18n backend while typing and hovering it. Warning if the translation is missing.
This gives the following experience:
Screencast from 2025-07-27 00-40-33.webm